home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 March: Reference Library / Dev.CD Mar 96 RL / Dev.CD Mar 96 RL.toast / Technical Documentation / develop / develop Issue 25 / develop Issue 25 code / QD3D to QTVR / ArticleCode / Source / context.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-21  |  1.3 KB  |  37 lines  |  [TEXT/MPCC]

  1. #include "QD3DtoQTVR.h"
  2. #include "extern.h"
  3. #include "context.h"
  4.  
  5.  
  6. TQ3DrawContextObject MyNewDrawContext(DocumentPtr    theDocument)
  7. {
  8.     TQ3PixmapDrawContextData myDrawContextData;
  9.     TQ3ColorARGB            clearColor = kMyAClearColor;
  10.     GWorldPtr                 theGWorld ;
  11.     PixMapHandle            hPixMap ;
  12.     Rect                    srcRect ;
  13.     
  14.     theGWorld = theDocument->drawContextOffscreen;
  15.     myDrawContextData.drawContextData.clearImageMethod = kQ3ClearMethodWithColor;
  16.     myDrawContextData.drawContextData.clearImageColor  = clearColor;
  17.     myDrawContextData.drawContextData.paneState = kQ3False;
  18.     myDrawContextData.drawContextData.maskState = kQ3False;
  19.     myDrawContextData.drawContextData.doubleBufferState = kQ3False;
  20.     
  21.     hPixMap = GetGWorldPixMap(theGWorld);
  22.     LockPixels(hPixMap);
  23.     srcRect = theGWorld->portRect;
  24.  
  25.     myDrawContextData.pixmap.width = srcRect.right  - srcRect.left;
  26.     myDrawContextData.pixmap.height= srcRect.bottom - srcRect.top;
  27.     myDrawContextData.pixmap.rowBytes = (**hPixMap).rowBytes & 0x7FFF;
  28.     myDrawContextData.pixmap.pixelType = kQ3PixelTypeRGB32;
  29.     myDrawContextData.pixmap.pixelSize = (*theGWorld->portPixMap)->pixelSize;
  30.     myDrawContextData.pixmap.bitOrder  = kQ3EndianBig;
  31.     myDrawContextData.pixmap.byteOrder = kQ3EndianBig;
  32.     myDrawContextData.pixmap.image        = (**hPixMap).baseAddr;
  33.     
  34.     return Q3PixmapDrawContext_New(&myDrawContextData);
  35. }
  36.  
  37.